new Vue({
	el: '#app',
	data: {
		uid: '',
		mobile: '',
		code: '',
		password: '',
		password_confirmation: '',
		api_token: ''
	},
	mounted: function() {
		this.init();
	},
	methods: {
		init: function() {

		},
		//关闭当前页
		close: function() {
			api.closeFrame();
		},
		jumpLogin: function() {
			api.closeFrame();
		},
		//发送短信验证
		sendMsg: function() {
			var self = this;
			var data = {
				mobile: self.mobile,
			};
			$.post(base + config.user_forgot_code, data, function(msg) {
				console.log(msg);
				if(msg.error == 0) {
					api.toast({
						msg: "发送成功",
						duration: 2000,
						location: 'middle'
					});
				} else {
					api.toast({
						msg: msg.error_msg,
						duration: 2000,
						location: 'middle'
					});
				}
			}, 'json');
		},
		//提交
		submitPassword: function() {
			var self = this;
			var data = {
				mobile: self.mobile,
				code: self.code,
				password: self.password,
				confirm: self.password_confirmation
			};
			$.post(base + config.user_forgot, data, function(msg) {
				if(msg.error == 0) {
					self.tel = "";
					self.password = "";
					self.password_confirmation = "";
					self.code = "";
					self.jumpLogin();
				} else {
					console.log(msg.error_msg);
					api.toast({
						msg: msg.error_msg,
						duration: 2000,
						location: 'middle'
					});
				}
			}, 'json');
		}
	}
})